package nccloud.web.fip.generate.action;

import nc.bs.generate.ift.IFIPGenerateService;
import nc.vo.pub.BusinessException;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.action.itf.ICommonAction;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.web.json.JsonFactory;

import java.util.Map;

/**
 * @author wangyong
 * @Date 2025-08-21
 */
public class VoucherWriteBillGenerateBackAction implements ICommonAction {

    @SuppressWarnings("rawtypes")
    @Override
    public Object doAction(IRequest request) {
        String json = request.read();
        Map valMap = JsonFactory.create().fromJson(json, Map.class);
        try {
            IFIPGenerateService  service = ServiceLocator.find(IFIPGenerateService.class);
            Boolean flag = service.voucherWriteBackBill(valMap);
            return flag;
        } catch (BusinessException e) {
            ExceptionUtils.wrapBusinessException("凭证维护 单据号、个人凭证号回写 凭证及单据生成异常:" + e.getMessage());
            return null;
        }
    }

}